package org.example.shejimoshi.create.danli;


import java.io.IOException;

//懒汉式单例模式的代码案例一
//线程安全出错
//线程安全无出错
public class LazySimpleSingleton {
    private LazySimpleSingleton() {
    }

    private static LazySimpleSingleton lazy = null;

    public static LazySimpleSingleton getInstance() {
        if (lazy == null) {
            lazy = new LazySimpleSingleton();
        }
        return lazy;
    }


    public static void main(String[] args) throws IOException {
        LazySimpleSingleton instance = LazySimpleSingleton.getInstance();
        HungrySingleton instance1 = HungrySingleton.getInstance();
        System.out.println(instance);
        System.out.println(instance1);

        LazySimpleSingleton instance2 = LazySimpleSingleton.getInstance();
        HungrySingleton instance3 = HungrySingleton.getInstance();

        System.out.println(instance2);
        System.out.println(instance3);

//        String input = "Hello, World!";
//        byte[] compressed = GZipUtil.compress(input);
//        String decompressed = GZipUtil.decompress(compressed);
//
//        System.out.println("Original: " + input);
//        System.out.println("Compressed: " + new String(compressed));
//        System.out.println("Decompressed: " + decompressed);
//        String a ="</Response>\r\n";
//        System.out.println(a.length());
//        String s = a.replaceAll("\r\n", "");
//        a = a.replaceAll("\r\n", "");
//
//        System.out.println(a.length());
//        System.out.println(s.length());


        String aaaad ="</Response>chenguo";
        String sadasdas
                = aaaad.replaceAll("chenguo", "");
        System.out.println(aaaad);
        aaaad = aaaad.replaceAll("chenguo", "");

        System.out.println(aaaad);
        System.out.println(sadasdas);

//        String originalStr = "Hello, world!";
//        System.out.println("原始数据：" + originalStr);
//        byte[] compressedData = CompressUtils.compress(originalStr);
//        System.out.println("压缩后的数据：" + new String(compressedData));
//        String decompressedStr = CompressUtils.decompress(compressedData);
//        System.out.println("解压后的数据：" + decompressedStr);

//        String a ="sdds";


    }

}
